﻿namespace UFIDA.U9C.Cust.ZL.BP.SOReadAR
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using UFIDA.U9.SM.SO;
    using UFSoft.UBF.AopFrame;
    using UFSoft.UBF.Util.Context;

    /// <summary>
    /// ReadAR partial 
    /// </summary>	
    public partial class ReadAR
    {
        internal BaseStrategy Select()
        {
            return new ReadARImpementStrategy();
        }
    }

    #region  implement strategy	
    /// <summary>
    /// Impement Implement
    /// 
    /// </summary>	
    internal partial class ReadARImpementStrategy : BaseStrategy
    {
        public ReadARImpementStrategy() { }

        public override object Do(object obj)
        {
            ReadAR bpObj = (ReadAR)obj;

            if (bpObj == null)
            {
                throw new NotImplementedException("参数为空");
            }
            //查询销售订单对应的未红冲应收单
            long soid = Convert.ToInt64(bpObj.SOID);
            UFIDA.U9.SM.SO.SO so = UFIDA.U9.SM.SO.SO.Finder.FindByID(soid);
            var solines = so.SOLines.OfType<SOLine>();
            
            List<long> arlist = BusinessLogic.RedARBySOLine(solines);
            return new ReturnDto() { Code = 0, Message = $"红冲{arlist.Count}条应收单" };


        }
    }

    #endregion


}